/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package parser;

import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
import java.io.*;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import scanner.CommentChars;
import scanner.Scanner;
import scanner.ScannerOutput;

import scanner.Token;
import structures.table.symboltable.GlobalItemInfoTable;
import structures.table.symboltable.TerminalItemInfo;
import structures.table.symboltable.TerminalType;

/**
 *
 * @author Slayer
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws FileNotFoundException, IOException {
        // TODO code application logic here
        List <String> kws = new ArrayList<String>();
        BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream("test.txt")));
        String line;
        while ((line = br.readLine()) != null){
            kws.add(line);
        }
        GlobalItemInfoTable tb = new GlobalItemInfoTable(new ArrayList());
        Scanner sc = new Scanner(tb, CommentChars.cCommentChars);
        ScannerOutput so = sc.scan("test.txt");
        List<Token> lst = so.getTokens();
        //System.out.println(new File(".").getAbsolutePath());
        System.out.println("Error = " + (so.getError().getMsg()));
       
        XStream xstream = new XStream(new DomDriver());
        String enc = xstream.toXML(so);
        
        System.out.println((byte)'#');
        
        System.out.println("\n + " + enc); 
        /*
        so = (ScannerOutput)xstream.fromXML(enc);
        for (Token t : lst){
            System.out.println(t);
        }
         * 
         */
    }
}
